package com.yserp.project.erp.store.inorder.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yserp.common.utils.mybatis.MybatisPlusUtil;
import com.yserp.project.erp.store.inorder.domain.InOrderItem;
import com.yserp.project.erp.store.inorder.mapper.InOrderItemMapper;
import com.yserp.project.erp.store.inorder.service.IInOrderItemService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 商品入库单子Service业务层处理
 *
 * @author yserp
 * @date 2022-07-01
 */
@Service
public class InOrderItemServiceImpl extends ServiceImpl<InOrderItemMapper,InOrderItem> implements IInOrderItemService {
    @Resource
    private InOrderItemMapper inOrderItemMapper;

    /**
     * 查询商品入库单子
     *
     * @param id 商品入库单子主键
     * @return 商品入库单子
     */
    @Override
    public List<InOrderItem> selectInOrderItemByMainId(Long mainId) {
        InOrderItem inOrderItem =new InOrderItem();
        inOrderItem.setInOrderId(mainId);
        return this.selectInOrderItemList(inOrderItem);
    }


    /**
     * 查询商品入库单子列表
     *
     * @param inOrderItem 商品入库单子
     * @return 商品入库单子
     */
    @Override
    public List<InOrderItem> selectInOrderItemList(InOrderItem inOrderItem) {
        QueryWrapper<InOrderItem> query = new QueryWrapper<>();
        MybatisPlusUtil.notNullField(inOrderItem,query);
        return inOrderItemMapper.selectList(query);
    }

}
